Release 10.1A: OpenEdge Development:
Debugging and Troubleshooting


New Breakpoint dialog box

The New Breakpoint dialog box lets you set new breakpoints and watchpoints.

Access this dialog box by choosing the New button on the Breakpoints dialog box. For more information, see the "Breakpoints dialog box" section.

The New Breakpoint dialog box contains the following tabs:

Setting a breakpoint in a procedure

To add a breakpoint at a specific line in a named procedure:

  1. In the New Breakpoint dialog box, select the At Line tab.
  2. Enter the name of an OpenEdge procedure.
  3. Enter an integer that specifies a line number in the current or specified procedure.
  4. Specify a condition that must be satisfied for the breakpoint to be honored (optional).
  5. Choose the OK button.

A breakpoint indicator appears in red in the shaded area to the left of each line in the source code pane where a breakpoint is set. You can also add a breakpoint by clicking in the shaded area to the left of a line in the source code pane directly.

Procedure names and line numbers

Consider the following when setting a breakpoint:

Conditional breakpoints

A condition is any expression that the 4GL interpreter can evaluate to a logical value. The expression can include variables, buffer fields, object methods and attributes, logical operators (AND, OR, and so forth), comparison operators (=, <>, EQ, NE, and so forth), and other code entities.

The 4GL interpreter validates the expression syntax when the breakpoint is added, but does not check variable references. If any variables in the condition are out-of-scope or nonexistent, the interpreter interrupts execution (as if honoring the breakpoint) and displays an error message in the Debugger.

If the expression attempts to execute an I/O blocking statement (for example, a user-defined function that includes an UPDATE statement), the 4GL interpreter displays an error message over the application window, not in the Debugger window. Note in this case that code in the user-defined function preceding the UPDATE statement is executed.

You can add a condition to any existing breakpoint (except those that are triggered by an error) by selecting the breakpoint and choosing the Edit button in the Breakpoints dialog box. For more information, see the "Edit Breakpoint dialog box" section.

Setting an error-based breakpoint

To add a breakpoint triggered by an error:

  1. In the New Breakpoint dialog box, select the On Error tab. Select the appropriate radio button, as follows:
    • Any Unsuppressed Error — The Debugger gains control on the occurrence of any error not suppressed by a NO-ERROR. This type of breakpoint appears in the Breakpoints list as “Break on any unsuppressed error.”
    • Any Error — The Debugger gains control on the occurrence of any error regardless of whether the error is suppressed by a NO-ERROR. This type of breakpoint appears in the Breakpoints list as “Break on any error.”
    • On Error — The Debugger gains control on the occurrence of the specifically identified error, regardless of whether the error is suppressed by a NO-ERROR. This type of breakpoint appears in the Breakpoints list as “Break on Error #nnnnn.”
  2. Enter an integer of 1–5 digits that identifies a specific error (available, and required, only when On Error is selected).
  3. Choose the OK button.
Breakpoints triggered by errors

Consider the following when setting breakpoints based on errors:

Setting a watchpoint

To add a watchpoint:

  1. In the New Breakpoint dialog box, select the Watchpoint tab.
  2. Type the name of a variable, buffer field, object attribute, or object reference in the Expression field. You can optionally add a condition in the Condition field.
  3. Note: A watchpoint requires a watchpoint expression. If you do not enter an expression and choose OK, an error message appears in an alert box.

  4. Choose OK to create the watchpoint.

Watchpoints appear in the Breakpoints dialog box as “When expression changes [and condition]”. The third and fourth items in Figure 3–17 are watchpoints.

Figure 3–17: Watchpoint example

Entering a watchpoint automatically creates a watch for the watchpoint expression. If you leave the Add Watch toggle checked, the Debugger displays the watch in the Watches pane of the Debugger's main window. You can uncheck the Add Watch toggle box to override this behavior (Add Watch is checked by default). The Debugger shows the current value of all watches each time the Debugger gains control of the application.

Note: The watch and watchpoint are not connected to each other. Deleting the watchpoint does not delete the watch. Deleting the watch does not delete the watchpoint.

If the watchpoint expression or condition is invalid, the Debugger creates the watchpoint and displays an error message. In this case, edit the watchpoint and correct the mistake. If you do not fix the watchpoint before continuing program execution, the 4GL interpreter will generate an error when it gains control (via Step Into, Step Over, Continue, etc.) and will disable the watchpoint.

Watchpoint expressions

A watchpoint expression can be a variable (including array elements), field (including array elements), attribute reference (including chained references), or 4GL built-in function, such as PROPATH. (For a complete list of valid functions, see Table 3–2.) However, the expression might not be a CLOB, BLOB, LONGCHAR, RAW, or MEMPTR variable or field. The Debugger checks only that the watchpoint expression follows the conventions for a valid watch.

Note: Watchpoints are not valid on the name of an array. You must specify a particular array element to watch.

Watchpoint conditions

A condition can be any expression that the 4GL interpreter can evaluate to a logical value. The condition can include references to one or more program variables (including array elements), buffer fields (including array elements), or object attributes; you are not limited to the variable, field, or attribute specified in the watchpoint expression.

When you create a watchpoint, the Debugger checks only that the syntax of the condition is valid. The Debugger cannot verify the existence of variables and fields in the condition, as the references to variables or fields might not be in scope.

Adding a watchpoint to a watch

To add a watchpoint to an existing watch, right-click on a watch in the Watches pane and select Create Watchpoint from the pop-up menu.

The status bar displays the message “Watchpoint created for <expression>” to inform you that the operation was successful. If the operation fails, an alert box displays an error message.

Note: If you want to add a condition to the new watchpoint created on an existing watch, you must bring up the Breakpoints dialog box, select the watchpoint, click the Edit button, and enter the condition in the Edit Breakpoint dialog box.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095